Repository navigation
Remove the extra settlement projection from native C1 quota - #9004
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · reasoning_effort=max
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
使用 Codex App 心跳的 Agent 需要从一次已获准的工作唤醒中,知道该用哪个回执写回、记账和恢复。旧的 App 原生路径会先向 TypeScript 请求一次结算投影,再构造完整工作契约,为同一轮工作重复传输结算事实。变更后一次组合就给出原工作轮次的回执、结算命令及记账来源,Hook 输出丢失后仍可按原回执恢复。本轮覆盖源码运行时、File 和 SQLite,以及已有 CLI 与 Hook 路径。实机安装和真实模型效果沿父级里程碑验收。
改动思路 / Approach
共享 TypeScript 组合器已拥有现行结算契约,删除 App 专用的第二次投影后,原回执和准备状态仍由原 owner 核对。本次变更止于捕获前的契约组合和对应回归。捕获前先挂载现有能力上下文,再一次组合完整契约。既有执行准备、不可变读回、实际写回和扣额继续由各自入口核验。组合入口 准备入口
具体改动 / Changes
精确提交 e12d34d53de3a2a9652ef92dec520481b6cdce8e,基线 65ae1d6ec05d0594947a7a47e1e2fc7d7b304e86。9 个文件共 +121/-191。按 C1 的 one-pre-capture-owner 和 original-turn-once-only 两项验收分别核对一次组合和原回执生命周期。C1 规范
关键代码讲解
completeCliSettlementChannel要求已准入、允许执行和写回,且 Goal、Agent、Todo、Turn 与完整回执一致。硬租约还核对准备状态及其身份,软认领沿已准入原回执。提交、升级和重放继续共用现有状态。准备与回执判定- 两个 Provider 各跑 App heartbeat 和 SSH 的 Context On/Off,基线和候选各 8 例。App On 的结算相关 provider 调用从 2 次变 1 次,参数与结果合计少 13,623–13,651 UTF-8 字节;SSH 和 Off 各保持一次。扣额来源分别保持
heartbeat和visible-goal。这里测的是序列化体积。写回计划 - 执行返回的命令,File/SQLite 的软认领、硬租约和两种 POSIX CLI 别名均只扣额一次,重放返回同回执。Hook 遗失后需实际阅读原捕获内容;只有投影、伪造内容或历史标记均无法取得新的执行资格。首次内联重规划在两种调用顺序下保持原轮次绑定,写回前不可扣额。结算回归 Hook 恢复 历史拒绝 重规划
对主干的风险 / Risks
独立运行的 CLI、准备和重规划 163 项,结算 210 项,TypeScript 结算 13 项均通过。标准本地预检通过 6 项直接、18 项所选检查,Ruff 和配置范围内 mypy 通过。扩展组 46 项通过、8 项跳过;40,000 字符的可选召回测试在基线和候选同一指令断言失败,70,000 字符对照通过。该独立单元路径直接调用召回结果处理,绕过本次结算组合。作者先前重叠运行遇到过 SQLite 会话根只读回执,本轮完整准备组覆盖了该会话根并通过,间歇原因仍未知。现有召回断言
语义与 CI 对齐
Context Off 的 Hook 返回空结果且权威日志逐字节一致,独立守卫对照也没有创建原生会话文件。本地源码与受控 Hook 证据已覆盖当前合约。实机安装、Windows 和真实模型的配对成本与结果待父级验收。
我的整体评价 / Verdict
通过本提交的代码评审。共享组合器减少了 App 传输,原工作轮次仍能从允许的入口恢复并单次结算。现有可选召回断言的失败保留为基线问题,安装验收仍需沿父级里程碑核对。
English verdict: APPROVE. The exact head removes the redundant App projection while preserving original Turn, lease, debit source, and once-only settlement across both local stores.
Goal and delivered outcome
A ready Codex App heartbeat projected the settlement plan in a separate Effect Runtime call and then composed its complete C1 source. Every decided
quota should-runalready uses the complete composer after #8956. This change removes the App-only projection from the actual wake path and removes its internal runtime handler. One TypeScript composer checks the admitted original receipt and publishes settlement before the source is captured.Related to the C1 caller replacement and cutover unit. Target
main.Author declaration
completeCliSettlementChannelinloopx/control_plane/quota/settlement_plan.ts. The native Hook and inline delivery now consume the same plan.The prior CLI route test assumed agent-owned spend for soft claims. Both eligible handoff modes now test the C1 plan through the generated console route. The native Hook fixture follows the reader returned after a saved C1 source is verified. The historical marker refusal explicitly uses an unsigned synthetic historical carrier. The inline replan fixture checks the complete source, exact selected Todo and original settlement identity in both admission orders.
Validation
Tested revision
e12d34d53de3a2a9652ef92dec520481b6cdce8e.Run state finished. Inputs were synthetic.
File and SQLite used the actual CLI and TypeScript Effect Runtime. Native Hook fixtures exercised directory and session-root navigation, Codex App heartbeat and SSH Goal, missing or different ambient sessions, projection-only and mismatched readbacks, and repeated original claims.
Six immutable base/head synthetic cases matched for the ready plan, executable commands, preparation and original receipt binding after normalizing checkout paths and fixture-specific capture-derived claim keys. Each of the four App cases reduced settlement/composition requests from three to two across pre-claim and ready guards and reduced logical request payload plus response envelope by 13,980–14,054 bytes. Both SSH Goal controls stayed at two calls. Counts and bytes cover this bridge only.
Removing complete composition in a disposable baseline checkout makes the real Off CLI journey advertise the manual v1 plan, failing the same v2/receipt oracle. The baseline source was restored.
79 focused TypeScript tests, full TypeScript typecheck, configured Python mypy, changed-file Ruff, DCO and RFC pair check pass.
The final head passes 42 source-level Python tests across exact App/SSH readiness and readback, original-turn settlement, process interruption, generated CLI routing and inline replan. An earlier overlapping run returned readback-only once in the SQLite session-root variant. An isolated recheck and the final suite reached readiness with the existing timeout.
The standard local premerge gate passed 6 direct validations and all 18 selected checks, with a valid exact-diff change-quality receipt.
Scope and continuation
One internal projection and dispatch are removed. Complete composition still uses the original receipt. The existing historical readers, recovery commands, optional capability attachment and settlement enforcement owners remain active. Source tests cover claim and replay on isolated File and SQLite. Installed desktop-session adoption, release rollback, Windows and the matched model comparison remain to qualify.
Frontend / Visual Evidence
Type of Change
LoopX Area
Shared-authority RFC fixture impact
N/A. This changes transport for the decided plan. No provider transition or store operation is added.
Boundary Checklist